let routesConfig = require('./routes.js')
let express = require('express');
let router = express.Router();

//配置路由
Object.keys(routesConfig).forEach( (v) => {
  for(let server in routesConfig[v]){
    if(v.toLocaleLowerCase() === 'get'){
      router.get(server,routesConfig[v][server])
    }else if(v.toLocaleLowerCase() === 'post'){
      router.post(server,routesConfig[v][server])
    }else if(v.toLocaleLowerCase() === 'put'){
      router.put(server,routesConfig[v][server])
    }else if(v.toLocaleLowerCase() === 'delete'){
      router.delete(server,routesConfig[v][server])
    }else{
      new Error('excepetd method')
    }
  }
})
// console.log()
module.exports = router
